const app = getApp() //获取app.js这个文件
const util=require('../../utils/util.js')//导入util.js文件
Page({

  data: {
    radio: '0', // 购买方案按钮
    price: 0,  // 价格
    payWaysRadio: '0', // 支付方式按钮
    beginTime: '',
    endTime: ''
  },

  onLoad(options) {
    this.setData(this.data)
  },
  buy(e) {
    if(e.currentTarget.dataset.name == 'one') {
      this.data.price = 10
    }
    if(e.currentTarget.dataset.name == 'two') {
      this.data.price = 25
    }
    if(e.currentTarget.dataset.name == 'three') {
      this.data.price = 120
    }
    if(e.currentTarget.dataset.name == 'four') {
      this.data.price = 600
    }
    this.setData(this.data)
  },
  onChange(event) {
    this.setData({
      radio: event.currentTarget.name
    })
  },
  deal(event) {
    util.alert('支付成功！')
  },
  onChangePayWays(event) {
    this.setData({
      payWaysRadio : event.currentTarget.name
    })
  }, 
})